// 创建命令式弹窗
import { createApp } from "vue";
import MessageBox from './MessageBox.vue'

export function showMsg(msg: string, handleClick?: () => void) {
  const div = document.createElement("div");
  document.body.appendChild(div);
  const app = createApp(MessageBox,{msg, onClick: handleClick});
  app.mount(div);

  return () => {
    app.unmount();
    document.body.removeChild(div);
  };
}